﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo3
{

    class Program
    {
        static void Main(string[] args)
        {
            //List<Student> students = new List<Student>();

            var stu1 = new Student
            {
                StuId = "2022011",
                FirstName = "张",
                LastName = "无忌",
                Sex = true,
                Birthday = DateTime.Parse("2000-1-12")
            };
            var stu2 = new Student
            {
                StuId = "2022022",
                FirstName = "郭",
                LastName = "靖",
                Sex = true,
                Birthday = DateTime.Parse("2000-1-1")
            };
            var stu3 = new Student
            {
                StuId = "2022003",
                FirstName = "杨",
                LastName = "过",
                Sex = true,
                Birthday = DateTime.Parse("2000-11-1")
            };
            var stu4 = new Student
            {
                StuId = "2022004",
                FirstName = "黄",
                LastName = "蓉",
                Sex = false,
                Birthday = DateTime.Parse("2000-3-1")
            };
            var stu5 = new Student
            {
                StuId = "2022015",
                FirstName = "郭",
                LastName = "襄",
                Sex = false,
                Birthday = DateTime.Parse("2000-2-1")
            };

            //students.Add(stu1);
            //students.Add(stu2);
            //students.Add(stu3);
            //students.Add(stu4);
            //students.Add(stu5);

            //// 输出
            //Console.WriteLine("学号\t姓名\t性别\t出生年月");
            //foreach(var stu in students)
            //{
            //    Console.Write($"{stu.StuId}\t{stu.FullName()}\t{(stu.Sex ? "男" : "女")}\t{stu.Birthday.ToString("yyyy年MM月")}");
            //    Console.WriteLine();
            //}

            //// lamda
            //students.Sort((s1, s2) => s1.StuId.CompareTo(s2.StuId));

            //Console.WriteLine("按学号进行排序");
            //// 输出
            //Console.WriteLine("学号\t姓名\t性别\t出生年月");
            //foreach (var stu in students)
            //{
            //    Console.Write($"{stu.StuId}\t{stu.FullName()}\t{(stu.Sex ? "男" : "女")}\t{stu.Birthday.ToString("yyyy年MM月")}");
            //    Console.WriteLine();
            //}

            //students.Sort((a, b) => a.FirstName.CompareTo(b.FirstName));
            //// 输出
            //Console.WriteLine("按姓进行排序");
            //Console.WriteLine("学号\t姓名\t性别\t出生年月");
            //foreach (var stu in students)
            //{
            //    Console.Write($"{stu.StuId}\t{stu.FullName()}\t{(stu.Sex ? "男" : "女")}\t{stu.Birthday.ToString("yyyy年MM月")}");
            //    Console.WriteLine();
            //}

            ClassInfo c = new ClassInfo()
            {
                ClassId = "A001",
                ClassName = "2022外包2班"
            };
            c.AddStudent(stu1);
            c.AddStudent(stu2);
            c.AddStudent(stu3);
            c.AddStudent(stu4);
            c.AddStudent(stu5);

            c.PrintAllStudents();

            var stu6 = new Student
            {
                StuId = "2022045",
                FirstName = "蔡",
                LastName = "徐坤",
                Sex = true,
                Birthday = DateTime.Parse("2000-4-1")
            };
            c.AddStudent(stu6);
            c.PrintAllStudents();

            Console.ReadKey();
        }
    }
}
